﻿using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Framework.Verifications;

namespace Pixysoft.Weblications.Sango
{
    class RandomSeedGenerator
    {
        int length = 0;
        List<int> times = new List<int>();

        public RandomSeedGenerator(int length)
        {
            this.length = length;
        }

        public int next()
        {
            if (times.Count >= length)
                throw Exceptions.ManualVerificationFailedException("random seed exceed " + length);

            Random random = new Random();

            while (true)
            {
                int timeofbattle = random.Next(0, length - 1);

                if (times.Contains(timeofbattle))
                    continue;

                times.Add(timeofbattle);

                return timeofbattle;
            }
        }
    }
}
